#if !defined(ERASE_NON_UNIQUE_H)
#define ERASE_NON_UNIQUE_H
#include <algorithm>

/*****************************************************************************************
						count_removed_duplicates
******************************************************************************************/
template <typename Container>
unsigned count_erase_non_unique(Container& c)
{
	typename Container::iterator i = std::unique(c.begin(), c.end());
	unsigned cnt = std::distance(i, c.end());
	c.erase(i, c.end());
	return cnt;
}


template <class Container, class pred>
unsigned count_erase_non_unique(Container& c, pred p)
{
	typename Container::iterator i = std::unique(c.begin(),c.end(), p);
	unsigned cnt = std::distance(i, c.end());
	c.erase(i, c.end());
	return cnt;
}

/*****************************************************************************************
						erase_non_unique
******************************************************************************************/
template <class Container>
void erase_non_unique(Container& c)
{
	c.erase(std::unique(c.begin(),c.end()), c.end());
}


template <typename Container, typename pred>
void erase_non_unique(Container& c, pred p)
{
	c.erase(std::unique(c.begin(),c.end(), p), c.end());
}

#endif
